package base.day26.udp;

import java.io.IOException;
import java.net.*;

public class MySocket1 {
    public static void main(String[] args) throws IOException {
        //找
        DatagramSocket ds = new DatagramSocket();
        //打包准备数据
        String s="发送数据";
        byte[] bytes = s.getBytes();
        //
        InetAddress name = InetAddress.getByName("SuperJohn");
        int port=10000;
        DatagramPacket dp = new DatagramPacket(bytes,bytes.length,name,port);

        //发送
        ds.send(dp);
        //关闭
        ds.close();
    }
}
